package plus.xj17520.org.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import plus.xj17520.base.result.JSONResult;
import plus.xj17520.org.service.IFileService;
import plus.xj17520.base.utils.FileOV;
/**
 * @projectName: pethomeProject
 * @package: plus.xj17520.org.controller
 * @className: fileController
 * @author: XiaoJue
 * @description: TODO
 * @date: 2022/5/25 11:01
 * @version: 1.0
 */
/**
 * 处理文件相关请求
 */
@RestController
@RequestMapping("/file")
public class FileController {

        @Autowired
        private IFileService fileService;

        /**
         * 图片文件上传
         * @return
         */
        @PostMapping("/fileUpload")
        public JSONResult fileUpload(@RequestParam("fileName") MultipartFile file){
            return fileService.fileUpload(file);
        }

        /**
         * 文件删除
         * @param fileOV
         * @return
         */
        @PostMapping("/fileDel")
        public JSONResult fileDel(@RequestBody FileOV fileOV){
            return fileService.fileDel(fileOV);
        }
}
